Copy Code
|
|
---|---|
$ npm install barcode-js@latest |
Use the -g flag if you have barcode-js installed as a global package.
Note that going from v11 to v13 is a major version upgrade, so the npm install command must be used.
For minor version updates, you can use npm update instead.
As of version 13, the parameters of the bx.analyze() function have changed.
For the type parameter, it is preferable to use the predefined BarcodeType constants instead of strings.
Before:
JavaScript |
Copy Code
|
---|---|
// barcode-js v11 const bx = require('barcode-js'); const params = { input: "path/filename.ext", type: ["code128", "code39"] } bx.analyze(params, function(err, results) { /* ... */ }); |
Now:
JavaScript |
Copy Code
|
---|---|
// barcode-js v13 const bx = require('barcode-js'); const params = { type: [bx.BarcodeType.CODE128, bx.BarcodeType.CODE39] } const input = "path/filename.ext"; bx.analyze(input, params, function(err, results) { /* ... */ }); |
You will need to update your existing code to reflect this change.
See the documentation of the analyze function for more information.